#!/bin/bash
set -x

REGISTRY={{registry_url}}
IMAGE_NAME={{postgresql_image_name}}

CONTAINER_NAME=postgresql

docker rm -f $CONTAINER_NAME

docker run \
  --restart always \
  --name $CONTAINER_NAME \
  --user=$UID:$(id -g $USER) \
  -p {{postgresql_port}}:5432 \
  -e POSTGRES_USER={{postgresql_user}} \
  -e POSTGRES_PASSWORD={{postgresql_password}} \
  -e PGDATA=/var/lib/postgresql/data/pgdata \
  -v {{postgresql_data_dir}}:/var/lib/postgresql/data \
  ${REGISTRY}/${IMAGE_NAME} 
